package com.zgg.utils;


import org.apache.commons.codec.binary.Base64;

/**
 * BASE64加密解密
 */
public class BASE64Utils {

    /**
     * BASE64解密
     *
     * @param key
     * @return
     * @
     */
    public static String decode(String key) {
        byte[] b = key.getBytes();
        Base64 base64 = new Base64();
        b = base64.decode(b);
        String s = new String(b);
        return s;
    }

    /**
     * BASE64加密
     *
     * @param key
     * @return
     * @
     */
    public static String encode(String key) {
        byte[] b = key.getBytes();
        Base64 base64 = new Base64();
        b = base64.encode(b);
        String s = new String(b);
        return s;
    }

}
